package com.zhongfl.crm.service.impl;

import com.zhongfl.crm.mapper.MessagePreventRepeatMapper;
import com.zhongfl.crm.model.boss.MessagePreventRepeat;
import com.zhongfl.crm.service.MessagePreventRepeatServiceApi;
import org.springframework.stereotype.Service;
import tech.heptagram.channel.api.common.AssertUtils;

import javax.annotation.Resource;

/**
 * 消息防重服务API
 *
 * @author wang.yuchuan
 * @date 2018/7/19
 */
@Service
public class MessagePreventRepeatServiceApiImpl implements MessagePreventRepeatServiceApi {

    @Resource
    private MessagePreventRepeatMapper messagePreventRepeatMapper;

    @Override
    public void save(MessagePreventRepeat messagePreventRepeat) {
        AssertUtils.notNull(messagePreventRepeat, "保存的参数为Null");
        AssertUtils.hasText(messagePreventRepeat.getMsgKey(), "保存的消息key不能为空");
        AssertUtils.hasText(messagePreventRepeat.getGroupId(), "保存的消息groupId不能为空");

        messagePreventRepeatMapper.insert(messagePreventRepeat);
    }
}
